﻿using System;

class NarcissisticNumbers
{
    static void Main(string[] args)
    {
        Console.WriteLine("100-999之间的所有水仙花数：");
        Console.WriteLine("==========================");

        int count = 0;

        for (int num = 100; num <= 999; num++)
        {
            if (IsNarcissisticNumber(num))
            {
                Console.WriteLine($"{num} = {GetDecomposition(num)}");
                count++;
            }
        }

        Console.WriteLine("==========================");
        Console.WriteLine($"总共找到 {count} 个水仙花数");
    }

   
    static bool IsNarcissisticNumber(int number)
    {
        int hundreds = number / 100;        
        int tens = (number / 10) % 10;     
        int units = number % 10;           

        int sumOfCubes = hundreds * hundreds * hundreds
                        + tens * tens * tens
                        + units * units * units;

        return sumOfCubes == number;
    }

   
    static string GetDecomposition(int number)
    {
        int hundreds = number / 100;
        int tens = (number / 10) % 10;
        int units = number % 10;

        return $"{hundreds}³ + {tens}³ + {units}³ = " +
               $"{hundreds * hundreds * hundreds} + " +
               $"{tens * tens * tens} + " +
               $"{units * units * units}";
    }
}